<%@ page import="java.util.Enumeration" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 9/16
  Time: 14:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>从request对象中获取请求参数</title>
</head>
<body>
    <h2>获取request对象中的参数</h2>
    <p>
        <%=request%>
    </p>
    <p>
        <%=request.getQueryString()%>
    </p>
    <%
        //当成一个迭代器使用，获取request请求中所有的url参数信息
        Enumeration<String> parameterNames = request.getParameterNames();
        while (parameterNames.hasMoreElements()) {
            String s = parameterNames.nextElement();
            System.out.println("url参数：" + s);
            System.out.println("参数对应的值：" + request.getParameter(s));
        }
    %>
    <p>
        <label>name = </label>
        <%=request.getParameter("name")%>
    </p>
    <p>
        <label>age = </label>
        <%=request.getParameter("age")%>
    </p>
    <p>
        <label>sex = </label>
        <%=request.getParameter("sex")%>
    </p>
</body>
</html>
